/**   
* @Title:：RabbitMQTestConroller.java 
* @Package ：com.example.deal.controller 
* @Description： TODO
* @author： Dustyone
* @date： 2019年4月4日 上午11:23:38  
*/
package com.example.deal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.deal.rabbit.RabbitClusterMsgDeliver;

/** 
* @ClassName:：RabbitMQTestConroller 
* @author ：Dustyone
* @date ：2019年4月4日 上午11:23:38  
*/
@RestController
@RequestMapping("/rabbitmq")
public class RabbitMQTestConroller {
	
	@Autowired
	private RabbitClusterMsgDeliver clusterMsgDeliver;
	
	/**
	 * 
	* @author： Dustyone
	* @Title：testAsiaCdsBrokerWarningNotify 
	* @Description：TODO
	* @param ：@param msg
	* @param ：@return 
	* @return ：String 
	* @throws
	 */
	@GetMapping("/testAsisWarningNotify/{msg}")
	public String testAsiaCdsBrokerWarningNotify(@PathVariable("msg") String msg) {
		clusterMsgDeliver.asiaCdsBrokerWarningNotifySendMsg(msg);
		return "SendSuccessed";
	}
	
	/**
	 * 
	* @author： Dustyone
	* @Title：testAsiaCdsBrokerWarningNotifyByGroup 
	* @Description：TODO
	* @param ：@return
	* @param ：@throws InterruptedException 
	* @return ：String 
	* @throws
	 */
	@GetMapping("/testAsisWarningNotifyByGroup")
	public String testAsiaCdsBrokerWarningNotifyByGroup() throws InterruptedException {
		for(int i = 0;i<=20;i++) {
			Thread.sleep(200);
			clusterMsgDeliver.asiaCdsBrokerWarningNotifySendMsg("Order-"+i);
		}
		return "SendSuccessed";
	}
	
	/**
	 * 
	* @author： Dustyone
	* @Title：testEuroCdsBrokerWarningNotify 
	* @Description：TODO
	* @param ：@param msg
	* @param ：@return 
	* @return ：String 
	* @throws
	 */
	@GetMapping("/testEuroWarningNotify/{msg}")
	public String testEuroCdsBrokerWarningNotify(@PathVariable("msg") String msg) {
		clusterMsgDeliver.euroCdsBrokerWarningNotifySendMsg(msg);
		return "SendSuccessed";
	}
	
	/**
	 * 
	* @author： Dustyone
	* @Title：testAsiaCdsBrokerCommonNotify 
	* @Description：TODO
	* @param ：@param msg
	* @param ：@return 
	* @return ：String 
	* @throws
	 */
	@GetMapping("/testAsisCommonNotify/{msg}")
	public String testAsiaCdsBrokerCommonNotify(@PathVariable("msg") String msg) {
		clusterMsgDeliver.asiaCdsBrokerCommonNotifySendMsg(msg);
		return "SendSuccessed";
	}
}
